home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bc_ti.zip / TI723.ASC < prev    next >
Text File  |  1992-02-25  |  901b  |  67 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland C++                            NUMBER  :  723
  9.   VERSION  :  2.0
  10.        OS  :  DOS
  11.      DATE  :  February 25, 1992                        PAGE  :  1/1
  12.  
  13.     TITLE  :  matherr and signal Handlers
  14.  
  15.  
  16.  
  17.  
  18.   /**************************************************************
  19.   This program illustrates how to use matherr and signal.
  20.   ***************************************************************/
  21.  
  22.   #include <math.h>
  23.   #include <string.h>
  24.   #include <stdio.h>
  25.   #include <signal.h>
  26.  
  27.   /*
  28.   New matherr function.
  29.   */
  30.  
  31.   int matherr(struct exception *s)
  32.   {
  33.       puts("matherr!! \n");
  34.       return 1;
  35.   }
  36.  
  37.   /*
  38.   New signal handler.
  39.   */
  40.  
  41.   void catcher(void)
  42.   {
  43.        puts("catcher!!\n");
  44.   }
  45.  
  46.   int main(void)
  47.   {
  48.       int x;
  49.  
  50.       signal(SIGFPE,catcher);
  51.       x = log(-1);
  52.       return 0;
  53.   }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.